package com.hackerrank.challenges.runningtimeofalgorithms;

import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
    	Scanner in = new Scanner(System.in);
		int N = in.nextInt(), a[] = new int[N], c = 0;
		for(int n = 0; n < N; n++)
			a[n] = in.nextInt();
		for(int i = 1; i < N; i++)
			for(int j = 0; j < i; j++)
				if(a[j] > a[i])
					c++;
		System.out.println(c);
    }
}
